package com.aiyige.utils.removal.model;

import java.util.List;

public class VideoCacheParentModel {

    public static final int STATUS_WAIT_DOWNLOAD = 0;//未下载
    public static final int STATUS_FINISHED = 1;//下载完成
    public static final int STATUS_DOWNING = 2;//正在下载
    public static final int STATUS_PAUSE = 3;//暂停

    public static final int TYPE_VIDEO = 0;//0代表看(普通视频)
    public static final int TYPE_COURSE_VIDEO = 1;//1代表学(教学视频)


    private int localId;

    //用户ID
    private String userId;

    //视频ID
    private String videoId;

    //缓存类型:0代表看,1代表学
    private int typeId = -1;

    //标题
    private String title;

    //描述
    private String description;

    //视频封面图
    private String cover;

    //缓存状态
    private int status;

    //视频总个数
    private int total;

    //已下载视频个数
    private int downloadCount;

    //缓存总大小
    private long size;

    //已缓存的文件大小
    private long completeSize;

    //ServerCode
    private String serverCode;

    //缓存时间
    private String createTime;

    private List<VideoCacheChildModel> childModelList;

    private VideoCacheParentModel(Builder builder) {
        setLocalId(builder.localId);
        setUserId(builder.userId);
        setVideoId(builder.videoId);
        setTypeId(builder.typeId);
        setTitle(builder.title);
        setDescription(builder.description);
        setCover(builder.cover);
        setStatus(builder.status);
        setTotal(builder.total);
        setDownloadCount(builder.downloadCount);
        setSize(builder.size);
        setCompleteSize(builder.completeSize);
        setServerCode(builder.serverCode);
        setCreateTime(builder.createTime);
        setChildModelList(builder.childModelList);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public List<VideoCacheChildModel> getChildModelList() {
        return childModelList;
    }

    public void setChildModelList(List<VideoCacheChildModel> childModelList) {
        this.childModelList = childModelList;
    }

    public void setLocalId(int localId) {
        this.localId = localId;
    }

    public int getLocalId() {
        return localId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserId() {
        return userId;
    }

    public void setVideoId(String videoId) {
        this.videoId = videoId;
    }

    public String getVideoId() {
        return videoId;
    }

    public void setTypeId(int typeId) {
        this.typeId = typeId;
    }

    public int getTypeId() {
        return typeId;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    public String getCover() {
        return cover;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getStatus() {
        return status;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getTotal() {
        return total;
    }

    public void setDownloadCount(int downloadCount) {
        this.downloadCount = downloadCount;
    }

    public int getDownloadCount() {
        return downloadCount;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public long getSize() {
        return size;
    }

    public void setCompleteSize(long completeSize) {
        this.completeSize = completeSize;
    }

    public long getCompleteSize() {
        return completeSize;
    }

    public void setServerCode(String serverCode) {
        this.serverCode = serverCode;
    }

    public String getServerCode() {
        return serverCode;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getCreateTime() {
        return createTime;
    }

    public static final class Builder {
        private int localId;
        private String userId;
        private String videoId;
        private int typeId;
        private String title;
        private String description;
        private String cover;
        private int status;
        private int total;
        private int downloadCount;
        private long size;
        private long completeSize;
        private String serverCode;
        private String createTime;
        private List<VideoCacheChildModel> childModelList;

        private Builder() {
        }

        public Builder localId(int val) {
            localId = val;
            return this;
        }

        public Builder userId(String val) {
            userId = val;
            return this;
        }

        public Builder videoId(String val) {
            videoId = val;
            return this;
        }

        public Builder typeId(int val) {
            typeId = val;
            return this;
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder description(String val) {
            description = val;
            return this;
        }

        public Builder cover(String val) {
            cover = val;
            return this;
        }

        public Builder status(int val) {
            status = val;
            return this;
        }

        public Builder total(int val) {
            total = val;
            return this;
        }

        public Builder downloadCount(int val) {
            downloadCount = val;
            return this;
        }

        public Builder size(long val) {
            size = val;
            return this;
        }

        public Builder completeSize(long val) {
            completeSize = val;
            return this;
        }

        public Builder serverCode(String val) {
            serverCode = val;
            return this;
        }

        public Builder createTime(String val) {
            createTime = val;
            return this;
        }

        public Builder childModelList(List<VideoCacheChildModel> val) {
            childModelList = val;
            return this;
        }

        public VideoCacheParentModel build() {
            return new VideoCacheParentModel(this);
        }
    }


    
    public boolean isAllDownloaded() {
        return status == VideoCacheParentModel.STATUS_FINISHED;
    }
}
